﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HomeWork
{
    internal class IRepository<T>
    {
        public static IList<T> entities;

        static IRepository()
        {
            entities = new List<T>();
        }

        public void Save(T entity)
        {
            if (entities == null)
            {
                entities = new List<T>();//空集合
            }
            entities.Add(entity);
        }

       

        public T Get(int id) 
        { 
            return entities[id];
        }

        public void Delete(int id)
        {
            entities.RemoveAt(id);
        }
    }
}
